#include "process.h"

double target_file_size = 1024.0;
double speed = 1.0;

void DownLoad(double size, double split)
{
    double current_total = 0.0;
    while(current_total <= size)
    {
        FlushProcess(size, current_total);
        if(current_total >= size) break;
        usleep(50000);
        current_total += split;
        if(current_total > size)
            FlushProcess(size, current_total);
    }
    printf("\n");
}

int main()
{
    printf("下载中：\n");
    DownLoad(100.0,1.0);
    DownLoad(512.0,30.0);
    DownLoad(100.0,3.0);
    DownLoad(512.0,20.0);
    DownLoad(100.0,5.0);
    return 0;
}
